package com.lepu.app.fun.chat.core;


import org.jivesoftware.smack.XMPPConnection;

import com.lepu.app.fun.chat.bean.ChatError;
import com.lepu.app.fun.chat.bean.ChatMessage;
import com.lepu.app.fun.chat.bean.ChatRoomMessage;


/**
 * Created by Chang on 9/19/2014.
 */
public interface IClientChat {

    boolean isConnectionClosed();

    boolean isConnectionValid();

    void setConnectionClosed(boolean value);

    XMPPConnection getConnection();

    void login(final String host, final int port, final long userId, final String password);

    void disconnect();

    void listenIncomingMessages();

    void sendServerTimeIQ();//与服务器时间校准，似乎现在已不用

    void sendMessageIQ(long fromId, long toId, String messageId);

    void setXmppListener(XmppListener callback);

    void sendMessage(ChatMessage chatMessage);

    void sendChatRoomMessage(ChatRoomMessage chatMessage);

    void stopConnectTimer();

    void startConnectTimer();

    public interface XmppListener {
        void onLogin();

        void onServerTime(String tm);

        void onIQMessage(MessageStateIQ messageState);
        
        //消息回执
        void onReceiveReceipt(ChatMessage chatMessage);

        //消息回执
        void onReceiveReceiptRoom(ChatRoomMessage chatRoomMessage);
        
        //error
        void onXmppError(long sessionId, String messageId, ChatError chatError);

        //私聊接收到消息  默认  //接收到医生消息
        void onReceiveMessage(ChatMessage chatMessage);
        
        //接收到在线咨询消息
        void onReceiveStaffMessage(ChatMessage chatStaffMessage);

        //群聊接收到消息
        void onReceiveGroupChatMessage(ChatRoomMessage chatMessage);
       
    }
}


